package main

import "fmt"

func duplicateNumbersXOR(nums []int) int {
	var result int
	countMap := make(map[int]int)
	for i := 0; i < len(nums); i++ {
		countMap[nums[i]] = countMap[nums[i]] + 1
	}
	for k, v := range countMap {
		if v == 2 {
			result = result ^ k
		}
	}
	return result
}

func main() {
	nums := []int{10, 18, 7, 10, 18}
	fmt.Println(duplicateNumbersXOR(nums))
}
